//
//  DetailsVC.m
//  212--Homework  QQy音乐  阿里星球
//
//  Created by li cheng on 16/8/15.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "DetailsVC.h"
#import "DetailsTableView.h"
#import "DetailsTableViewCellSmallButton.h"
#import "ShufflePlayTableViewCell.h"
#import "SongPlayerTableViewCell.h"
#import "CollectTableViewCell.h"
#import "MoreSongeTableViewCell.h"
#import "DetailsHeadView.h"
@interface DetailsVC ()<UITableViewDelegate, UITableViewDataSource>

@end

@implementation DetailsVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    DetailsTableView *detailsTableView = [[DetailsTableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    [self.view addSubview:detailsTableView];
    detailsTableView.delegate = self;
    detailsTableView.dataSource = self;
    [detailsTableView registerNib:[UINib nibWithNibName:@"DetailsTableViewCellSmallButton" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"DetailsTableViewCellSmallButton"];
    [detailsTableView registerNib:[UINib nibWithNibName:@"ShufflePlayTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"ShufflePlayTableViewCell"];
    [detailsTableView registerNib:[UINib nibWithNibName:@"SongPlayerTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"SongPlayerTableViewCell"];
    [detailsTableView registerNib:[UINib nibWithNibName:@"CollectTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"CollectTableViewCell"];
    
    [detailsTableView registerNib:[UINib nibWithNibName:@"MoreSongeTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"MoreSongeTableViewCell"];
    DetailsHeadView *headView = [[DetailsHeadView alloc] initWithFrame:CGRectMake(0, 0, 320, 200)];
    headView.backgroundColor = [UIColor redColor];
    detailsTableView.tableHeaderView = headView;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.row) {
        case 0:
        {
            DetailsTableViewCellSmallButton *cell = [tableView dequeueReusableCellWithIdentifier:@"DetailsTableViewCellSmallButton" forIndexPath:indexPath];
            return cell;
        }
            break;
            case 1:
        {
    
            ShufflePlayTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ShufflePlayTableViewCell" forIndexPath:indexPath];
            return cell;
        }
            case 2:
        {
            
            SongPlayerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SongPlayerTableViewCell" forIndexPath:indexPath];
            return cell;
        }
        case 3:
        {
            CollectTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CollectTableViewCell" forIndexPath:indexPath];
            return cell;
        }
        default:
        {
            MoreSongeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MoreSongeTableViewCell" forIndexPath:indexPath];
            return cell;
        }
            break;
    }
}
#pragma mark - 每个cell 的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 4) {
        return 200;
    } else {
        return 44;
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
